﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FXnaGis;

using FXnaInfrastructure;

namespace NSCore
{

    /// <summary>
    /// 常规噪声数据，简单就好
    /// </summary>
    [Serializable]
    public class NSData
    {

        public NSData()
        {


            //为图层添加一些初始化信息

            this._gridLayer.IsSelectable = false;







            this._timeDivides = new FEntityCollection();

            this._timeDivides.EntityReseted += new EventHandler(_timeDivides_EntityReseted);
            this._timeDivides.EntityAdded += new EventHandler<EntityEventArgs>(_timeDivides_EntityAdded);
            this._timeDivides.EntityRemoved += new EventHandler<EntityEventArgs>(_timeDivides_EntityRemoved);






            //默认数据部分放在初始化之后


            TimeDivision tdDay = new TimeDivision("day");
            tdDay.Desc = "白天";


            TimeDivision tdNight = new TimeDivision("night");
            tdNight.Desc = "晚上";

            this._timeDivides.Add(tdDay);
            this._timeDivides.Add(tdNight);






        }



        void _timeDivides_EntityRemoved(object sender, EntityEventArgs e)
        {
            throw new NotImplementedException();
        }

        void _timeDivides_EntityAdded(object sender, EntityEventArgs e)
        {

            foreach (FShape item in this._ptLayer.Shapes.Values)
            {

                PointSource ps = item as PointSource;

                ps.ResetTimedDivison(this.TimeDivides);
                
                
            }



            
        }

        void _timeDivides_EntityReseted(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }





        FEntityCollection _timeDivides ;


        /// <summary>
        /// 用于表示时间的划分
        /// </summary>
        public FEntityCollection TimeDivides
        {
            get { return _timeDivides; }
            set { _timeDivides = value; }
        }



        FVectorLayer _gridLayer = new FVectorLayer(NSCoreNames.GridLayer);

        /// <summary>
        /// 用于存储所有的网格单元
        /// </summary>
        public FVectorLayer GridLayer
        {
            get { return _gridLayer; }

            
        }



      




        FVectorLayer _scatterLayer = new FVectorLayer(NSCoreNames.ReceptorLayer);

        public FVectorLayer ScatterLayer
        {
            get { return _scatterLayer; }
            
        }


        FVectorLayer _ptLayer = new FVectorLayer(NSCoreNames.PointSourceLayer);

        public FVectorLayer PtLayer
        {
            get { return _ptLayer; }
           

        }



        FVectorLayer _barrierLayer = new FVectorLayer(NSCoreNames.BarrierLayer);

        public FVectorLayer BarrierLayer
        {
            get { return _barrierLayer; }
           
        }








    }
}
